// rp ++ never say die
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 10;

int n, a[N], b[N], s[N];
int tot[N], cnt = 0;
void koishi()
{
	scanf("%lld", &n);
	for (int i = 1; i <= n; i ++ )
	{
		scanf("%lld", a + i);
		if (tot[a[i]] == 0)
			b[++ cnt] = a[i];
		tot[a[i]] ++;
	}
	sort(b + 1, b + 1 + cnt);
	for (int i = 1; i <= cnt; i ++ )
		s[i] = tot[b[i]] + s[i - 1];
	int hasCount = 0;
	for (int i = 2; i <= cnt; i ++ )
	{
		if (tot[b[i]] > s[i - 1] - hasCount)
		{
			hasCount = s[i - 1];

		}
		else {
			hasCount += tot[b[i]];
		}
	}
	printf("%lld\n", n - hasCount);
}


#undef int
int main()
{
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	koishi();
	return 0;
}
